<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>商品添加</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" type="text/css" th:href="@{/css/style.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}"/>
    <script type="application/javascript" src="@{/layui/js/layui.js}"></script>
</head>
<body>
<div id="wrap">
    <div id="top_content">
        <div id="header">
            <div id="top-header">
                <h1 id="title">
                    <a href="#">商品管理系统</a>
                </h1>
            </div>
            <div id="navigation"></div>
        </div>
        <div id="content">
            <table class="table">
                <tr class="table_header">
                    <td>
                        编号
                    </td>
                    <td>
                        名称
                    </td>
                    <td>
                        价格
                    </td>
                    <td>
                        描述
                    </td>
                    <td>
                        创建时间
                    </td>
                    <td>
                        操作
                    </td>
                </tr>
                <tr th:class="${state.odd?'row1':'row2'}" th:each="goods,state:${goodsList}">
                    <td th:text="${goods.id}"></td>
                    <td th:text="${goods.name}"></td>
                    <td th:text="${goods.price}"></td>
                    <td th:text="${goods.description}"></td>

                    <td th:text="${#dates.format(goods.createTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                    <td>
                        <a th:href="@{/goods/delete(id=${goods.id})}">删除</a>&nbsp;
                        <a th:href="@{/goods/getUpdateDetail(id=${goods.id})}">更新</a>
                        <a th:href="@{/goods/getAddDetail}">添加</a>
                    </td>
                </tr>
            </table>

            <div class="paging-container">
                <div class="paging-left">
                    当前第 [[${current}]] 页
                    总计 [[${pages}]] 页
                    共 [[${total}]] 条记录
                </div>
                <div class="paging-right">
                    <div th:if="${current > 1}" class="prev"><a th:href="@{/goods/selectPage(current=${(current) - 1})}">← 前一页</a></div> &ensp;&ensp;
                    <div th:if="${current == 1}" class="prev disabled"><a>← 前一页</a></div>
                    <div th:class="${num == current?'active':''}" class="active" th:each="num:${#numbers.sequence(1, pages)}"><a th:href="@{/goods/selectPage(current=${num})}" class="num-item">[[${num}]]</a></div>
                    <div th:if="${current < pages}" class="next"><a th:href="@{/goods/selectPage(current=${(current) + 1})}">下一页 → </a></div>
                    <div th:if="${current == pages}" class="next disabled"><a>下一页 →</a></div>
                </div>
            </div>
        </div>
    </div>
    <div id="footer">
        <div id="footer_bg">
            ldd@126.com
        </div>
    </div>
</div>
</body>
</html>
